home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Original Shareware 1.1
/
The Original Shareware (WeMake CDs)(Volume 1.1)(CDs, Inc)(1993).iso
/
38
/
sgn_bans.zip
/
TRIM.PAS
< prev
Wrap
Pascal/Delphi Source File
|
1985-10-30
|
611b
|
25 lines
function Trim(Var StrInput ) : Integer ;
{Trims string, returns trimmed length}
Var
Str : string[255] absolute StrInput ;
m, n : integer ;
{m is a pointer into the string, and moves forwards from the end.}
{n is (1) the position of the last non-space, and }
{ (2) if <> 0, a flag that a non-space has been found.}
begin
m := Ord(Str[0]) ; {get current length of string}
n := 0 ;
while ( m > 0 ) and ( n = 0 ) do
begin
if Str[m] <> ' ' then n := m
else Str[0] := Pred(Str[0]) ; {reduce size in byte 0}
m := m - 1 ;
end ;
Trim := n ;
end ;